Class Query

Summary

Fully Qualified Name: CodeIgniter\Database\Query
Implements: QueryInterface

Description

Query builder

Methods

Name Description Defined By
__construct() BaseQuery constructor. Query
__toString() Return text representation of the query Query
getDuration() Returns the duration of this query during execution, or null if the query has not been executed yet. Query
getErrorCode() Returns the error code created while executing this statement. Query
getErrorMessage() Returns the error message created while executing this statement. Query
getOriginalQuery() Returns the original SQL that was passed into the system. Query
getQuery() Returns the final, processed query string after binding, etal has been performed. Query
getStartTime() Returns the start time in seconds with microseconds. Query
hasError() Reports whether this statement created an error not. Query
isWriteType() Determines if the statement is a write-type query or not. Query
setBinds() Will store the variables to bind into the query later. Query
setDuration() Records the execution time of the statement using microtime(true) for it's start and end values. If no end value is present, will use the current time to determine total duration. Query
setError() Stores the error description that happened for this query. Query
setQuery() Sets the raw query string to use for this statement. Query
swapPrefix() Swaps out one table prefix for a new one. Query

Method Details

__construct()

BaseQuery constructor.

Parameter Name Type Description
$db
$db

Returns:

__toString()

Return text representation of the query

Returns: string

getDuration()

Returns the duration of this query during execution, or null if the query has not been executed yet.

Parameter Name Type Description
$decimals int The

Returns: string

getErrorCode()

Returns the error code created while executing this statement.

Returns: int

getErrorMessage()

Returns the error message created while executing this statement.

Returns: string

getOriginalQuery()

Returns the original SQL that was passed into the system.

Returns: string

getQuery()

Returns the final, processed query string after binding, etal has been performed.

Returns: string

getStartTime()

Returns the start time in seconds with microseconds.

Parameter Name Type Description
$returnRaw bool
$decimals int

Returns: string

hasError()

Reports whether this statement created an error not.

Returns: bool

isWriteType()

Determines if the statement is a write-type query or not.

Returns: bool

setBinds()

Will store the variables to bind into the query later.

Parameter Name Type Description
$binds array

Returns: $this

setDuration()

Records the execution time of the statement using microtime(true) for it's start and end values. If no end value is present, will use the current time to determine total duration.

Parameter Name Type Description
$start float
$end float

Returns: $this

setError()

Stores the error description that happened for this query.

Parameter Name Type Description
$code int
$error string

Returns: $this

setQuery()

Sets the raw query string to use for this statement.

Parameter Name Type Description
$sql string
$binds mixed
$setEscape bool

Returns: $this

swapPrefix()

Swaps out one table prefix for a new one.

Parameter Name Type Description
$orig string
$swap string

Returns: $this

Top